package com.google.demo.mvc.action;


import com.google.demo.service.IDemoService;
import com.google.mvcframework.annotation.KCAutowired;
import com.google.mvcframework.annotation.KCController;
import com.google.mvcframework.annotation.KCRequestMapping;
import com.google.mvcframework.annotation.KCRequestParam;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@KCController
@KCRequestMapping("/two")
public class TwoAction {
    @KCAutowired private IDemoService demoService;
    @KCRequestMapping ("/edit.json")
    public void edit(HttpServletRequest req, HttpServletResponse resp,
                     @KCRequestParam("name") String name){
        String result=demoService.get(name);
        try{
            resp.getWriter().write(result);

        }catch (IOException e){
            e.printStackTrace();
        }

    }
}
